package com.ucar.umock.client.util;

import org.apache.commons.lang3.StringUtils;

/**
 * @clazz UMockTypeUtil
 * @Description TODO
 * @Author zhanbs baoshan.zhan@ucarinc.com
 * @Date 2020/4/3 11:10
 * @Version 1.0
 **/
public class UMockTypeUtil {

    /**
     * 判断是否是void 类型
     * @param clazz
     * @return
     */
    public static boolean isVoid(Class clazz){
        return StringUtils.equals("void",clazz.getName());
    }


    public static boolean isInt(Class clazz){
        return clazz.getName().equals(java.lang.Integer.class.getName());
    }
    public static boolean isShort(Class clazz){
        return clazz.getName().equals(java.lang.Short.class.getName());
    }
    public static boolean isByte(Class clazz){
        return clazz.getName().equals(java.lang.Byte.class.getName());
    }
    public static boolean isLong(Class clazz){
        return clazz.getName().equals(java.lang.Long.class.getName());
    }
    public static boolean isDouble(Class clazz){
        return clazz.getName().equals(java.lang.Double.class.getName());
    }
    public static boolean isFloat(Class clazz){
        return clazz.getName().equals(java.lang.Float.class.getName());
    }
    public static boolean isCharacter(Class clazz){
        return clazz.getName().equals(java.lang.Character.class.getName());
    }
    public static boolean isBoolean(Class clazz){
        return clazz.getName().equals(java.lang.Boolean.class.getName());
    }
    /**
     * 判断简单类型
     * @param clazz
     * @return
     */
    public static boolean isSimpleType(Class clazz){
        if (isInt(clazz) ||
                isShort(clazz)||
                isByte(clazz)||
                isLong(clazz)||
                isDouble(clazz) ||
                isFloat(clazz) ||
                isCharacter(clazz)||
                isBoolean(clazz)) {
            return true;
        }
        return true;
    }

    public static boolean isString(Class clazz){
        return clazz.getName().equals(java.lang.String.class.getName());
    }




}
